import { request } from '@/utils/request';

/**
 * 领券中心列表
 */
export function couponIndex(data?: Recordable) {
  return request({
    url: `/api/coupon/index`,
    method: 'get',
    params: data,
  });
}
// 领取优惠券 领券中心
export function couponGet(data?: Recordable) {
  return request({
    url: `/api/coupon/get`,
    method: 'post',
     data,
  });
}
// 获取用户优惠券
export function userCouponList(data?: Recordable) {
  return request({
    url: `/api/user/couponList`,
    method: 'get',
     params:data,
  });
}
export function orderList(data?: Recordable) {
  return request({
    url: `/api/order/list`,
    method: 'get',
     params:data,
  });
}
export function payPrepay(data?: Recordable) {
  return request({
    url: `/api/pay/prepay`,
    method: 'post',
     data,
  });
}
export function orderDetail(data?: Recordable) {
  return request({
    url: `/api/order/detail`,
    method: 'get',
    params: data,
  });
}
// 余额支付
export function payMoney(data?: Recordable) {
  return request({
    url: `/api/pay/money`,
    method: 'post',
     data,
  });
}
// paypal支付
export function payPaypal(data?: Recordable) {
  return request({
    url: `/api/pay/paypal`,
    method: 'post',
     data,
  });
}
// USDT支付
export function payUsdt(data?: Recordable) {
  return request({
    url: `/api/pay/usdt`,
    method: 'post',
     data,
  });
}
// 取消订单
export function orderCancel(data?: Recordable) {
  return request({
    url: `/api/order/cancel`,
    method: 'post',
     data,
  });
}
// 删除订单
export function orderDelete(data?: Recordable) {
  return request({
    url: `/api/order/delete`,
    method: 'post',
     data,
  });
}
export function orderConfirm(data?: Recordable) {
  return request({
    url: `/api/order/confirm`,
    method: 'post',
     data,
  });
}
export function orderComment(data?: Recordable) {
  return request({
    url: `/api/order/comment`,
    method: 'post',
     data,
  });
}
export function commonUpload(data?: Recordable) {
  return request({
    url: `/api/common/upload`,
    method: 'post',
     data,
     requestOptions: {
      headers: { 'Content-Type': 'multipart/form-data' },
     }
  });
}

export function orderApplyRefund(data?: Recordable) {
  return request({
    url: `/api/order/applyRefund`,
    method: 'post',
     data,
  });
}
export function goodsCommentList(data?: Recordable) {
  return request({
    url: `/api/goods/commentList`,
    method: 'get',
     params:data,
  });
}

export default {
  couponIndex,couponGet,
  userCouponList,
  orderList,
  payPrepay,
  orderDetail,
  payMoney,payPaypal,payUsdt,
  orderCancel,
  orderDelete,
  orderConfirm,
  orderComment,
  commonUpload,
  orderApplyRefund,
  goodsCommentList
};
